package com.lovi.io_.propertis_;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * 配置文件创建与修改
 */
public class Properties03_ {
    public static void main(String[] args) throws IOException {
        String filePath = "Java-03/src/main/resources/mysql2.properties";
        Properties properties = new Properties();
        properties.setProperty("user","张三");
        properties.setProperty("password","123456");
        properties.store(new FileOutputStream(filePath),"mysql2");
        System.out.println("保存配置文件成功！");
        System.out.println("尝试修改");
        properties.setProperty("user","李四");
        properties.setProperty("password","999999");
        properties.store(new FileOutputStream(filePath),"mysql2-edit");
        System.out.println("修改配置文件成功！");


    }
}
